/* Janus Chat - Version 1.0
 * Authors: Matthew Perry
 *          Michael Freid
 *          Marc Latou
 *          Richard Lee
 *
 * The Janus Chat Client is a highly secured
 * peer-to-peer chat client designed to facilitate
 * the transfer of sensitive data or as a communication
 * medium for the extra paranoid
 *
 * This file contains the header for the MainWindow
 * QT class which lays the frame for the Janus GUI */

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPushButton>
#include <QTcpServer>
#include <QTcpSocket>
#include "../lib/user.h"

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

    public:
        explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();

        User* getUser();

    private:
        Ui::MainWindow *ui;     /* Generated by QT to store all the UI elements */

        User* myUser;              /* Pointer to an object to hold information about the user */
        QPushButton* newTabButton; /* Pointer to the new tab button */
        QTcpServer* myServer;      /* A TCP server which accepts connections */

    private slots:
        void on_actionNew_triggered();                          /* Activated when the new connection menu button is clicked */
        void on_actionClose_triggered();                        /* Activated when the close connection menu button is clicked */
        void on_actionExit_triggered();                         /* Activated when the exit menu button is clicked */
        void on_actionPreferences_triggered();                  /* Activated when the preferences menu button is clicked */
        void on_actionAbout_triggered();                        /* Activated when the about menu button is clicked */
        void on_tabWidget_tabCloseRequested( int index );       /* Activated when a tab is closed */
        void newTabButton_clicked();                            /* Activated when the new tab button is clicked */
        void changeStatus( const QString& msg, int time = 0 );  /* Changes the status message on the status bar */
        void newConnection();                                   /* Deals with new connections from the TCP server */
        void newChat( QTcpSocket* sock );                       /* Spawns a new chat on successful connections */
        void monikerChange( const string& str );                /* Activated when the user changes his moniker */
};

#endif // MAINWINDOW_H
